Home:ALL Converter>Convert UNIX timestamp to milliseconds

Convert UNIX timestamp to milliseconds

Ask Time:2011-06-22T02:23:59         Author:MacMac

Json Formatter

How can I use PHP to get a UNIX timestamp like what I get from the JS method .getTime()? I seem to be having trouble since .getTime() returns milliseconds. I know I have to convert the timestamps first for JS to read it, but how can I do this?

Edit:

Agreed with the multiply by 1000, but why do I get this?:

timestamp: 1305593400
timestamp * 1000: 1.3055934E+12

timestamp: 1305612420
timestamp * 1000: 1.30561242E+12

timestamp: 1305635400
timestamp * 1000: 1.3056354E+12

timestamp: 1304901960
timestamp * 1000: 1.30490196E+12

timestamp: 1304944620
timestamp * 1000: 1.30494462E+12

Author:MacMac,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/6430126/convert-unix-timestamp-to-milliseconds
Ignacio Vazquez-Abrams :

UNIX timestamps are in seconds. Multiply by 1000.",
2011-06-21T18:24:58
LazyOne :

If you really need proper presentation -- use number_format().\n\n$timestamp = 1305593400;\n$ms = $timestamp * 1000;\necho number_format($ms, 0, '.', '');\n\n\nResult: 1305593400000",
2011-06-21T18:39:31
yy